var Page = function(){
    this.init();
};
Page.prototype = {
    params: {
        passport: '',
    },
    init: function(){
        this.initParams();
        this.initEvent();
    },
    initParams: function(){
        this.params.passport = Pub.getCookie('_PASSPORT');
    },
    getData: function(){
        var _this = this;
        var paramsObj = {
            passport: _this.params.passport
        };
        Api.platformsolutionlist(paramsObj, function(data){
            console.log(data);
            _this.getDataList(data.list);

        });
    },
    getDataList: function(data) {
        var _this = this;
        if(data && data.length > 0){
            var i = 0; len = data.length, html = '';
            for(i;i<len;i++){
              html +='<tr>';

                html +='<td class="text-c">'+data[i].name+' </td>'+
                    '<td class="text-c">'+data[i].describe+'</td>'+
                    '<td class="text-c">'+data[i].applicable+'</td>'+
                    '<td class="text-c">'+
                        '<a class="handle edit" solutionId="'+data[i].solutionId+'" soluName="'+data[i].name+'">编辑</a>'+
                    '</td>'+
                '</tr>';
            }

            $('#List').html(html);
            _this.clickEvent()
        } else {
            var html = '<tr>' +
                '<td class="text-c c-666" colspan="4" >暂无数据</td>' +
                '</tr>';
            $('#List').html(html);

        }
    },
    clickEvent:function(){
        var _this = this;
        $('.edit').on('click', function() {
            Pub.setSession('solutionId', $(this).attr('solutionId'));
            Pub.setSession('soluName', $(this).attr('soluName'));
            window.location.href = Pub.getHtmlUrl('./platform-set-edit.html');
        });
    },
    otherEvent:function(){
        var _this = this;
        $('.goods-checkbox input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        })
    },
    initEvent: function(){
        var _this = this;
         _this.getData();
        _this.otherEvent();
        _this.clickEvent();


    }
};
var page = new Page();